from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from wtforms import TextAreaField, StringField, SubmitField
from wtforms.validators import DataRequired, Length, URL, Optional

class PostForm(FlaskForm):
    """动态发布表单"""
    content = TextAreaField('内容', validators=[
        DataRequired(message='请输入动态内容'),
        Length(min=1, max=1000, message='动态内容长度必须在1-1000个字符之间')
    ])
    image = FileField('图片', validators=[
        Optional(),
        FileAllowed(['jpg', 'jpeg', 'png', 'gif'], '只允许上传图片文件！')
    ])
    submit = SubmitField('发布') 